﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Security.Cryptography;


namespace SwUI.PO
{
    public class PartNodeInfo
    {
        /// <summary>
        /// 节点名称
        /// </summary>
        public string nodeName { get; set; }
        /// <summary>
        /// 节点属性
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 节点属性
        /// </summary>
        public string ID { get; set; }
        /// <summary>
        /// 设计规范
        /// </summary>
        public string stdDesign { get; set; }
        /// <summary>
        /// 模板图纸
        /// </summary>
        public string temDraw { get; set; }

        /// <summary>
        /// 标识节点路径
        /// 例：/root/items/item1
        /// </summary>
        public string nodePath
        {
            get;
            set;
        }
        /// <summary>
        /// 标识父级节点路径
        /// </summary>
        public string pNodePath { get; set; }

        public string nodeTag
        {
            get
            {
                return GetMd5String(this.pNodePath + this.nodeName + this.name + this.ID);
            }
        }

        private  string GetMd5String(string str)
        {
            MD5 md5 = MD5.Create();
            byte[] buffer = Encoding.UTF8.GetBytes(str);
            byte[] md5Buffer = md5.ComputeHash(buffer);
            StringBuilder sb = new StringBuilder();
            foreach (byte b in md5Buffer)
            {
                sb.Append(b.ToString("x2"));
            }
            md5.Clear();//释放资源
            return sb.ToString();
        }

    }



}
